<%--
  Created by IntelliJ IDEA.
  User: 25131
  Date: 2021/10/7
  Time: 9:03
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>秒杀下单页面</title>


    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/res/layui/css/layui.css" media="all">
    <!-- 注意：如果你直接复制所有代码到本地，上述css路径需要改成你本地的 -->

    <link rel="stylesheet" href="${pageContext.request.contextPath}/css/seckill_place_an_order.css">

    <script src="${pageContext.request.contextPath}/res/jquery/jquery-3.5.1.min.js"></script>

</head>
<body>

<!--    <body id="mainframe">-->

<!--最上面的导航-->
<div class="shortcut-2014">
    <div class="w haha">
        <ul class="fr frfr">
            <li class="fore1 fore1zidingyi " id="ttbar-login">
                <div class="user-info-no">

                    <a href="${pageContext.request.contextPath}/customer/login.jsp" class="link-login">你好，请登录</a>
                    &nbsp;&nbsp;
                    <a href="${pageContext.request.contextPath}/customer/register.jsp" class="link-regist style-red">免费注册</a>
                </div>

                <div class="user-info-yes">

                    <span style="font-size: 12px">欢迎</span>
                    &nbsp;&nbsp;
                    <span class="userNickName" style="color: red;"></span>
                    &nbsp;&nbsp;
                    <span style="font-size: 12px">登录</span>
                    &nbsp;&nbsp;
                    <button onclick="logout()" style="border:none; background-color: #e3e4e5"
                            class="link-regist style-red">退出
                    </button>
                </div>

            </li>

            <li class="fore2">
                <div class="dt">
                    <a class="order-href" href="${pageContext.request.contextPath}/customer/login.jsp" target="_blank">我的订单</a>
                    <%--                        <a href="" target="_blank">我的订单</a>--%>
                </div>
            </li>

        </ul>
    </div>
</div>


<!-- 导航下面 -->
<div id="o-header-2013">
    <div id="header-2013" style="display:none;"></div>
</div>


<!-- 结算页所在的盒子 -->
<div class="w w1 header clearfix">

    <!-- 左边logo 和 结算页样式 -->
    <div id="logo-2014">
        <a href="" class="logo" target="_blank"></a>
        <a href="" class="link2">
            <b></b>
            秒杀结算页
        </a>
    </div>

    <!-- 右边订单进度显示 -->
    <div class="stepflex" id="#sflex03">

        <!-- 我的购物车样式 -->
        <dl class="first done">
            <dt class="s-num">1</dt>
            <dd class="s-text">
                1.我的购物车
                <s></s>
                <b></b>
            </dd>
        </dl>

        <!-- 填写核对订单信息样式 -->
        <dl class="normal doing">
            <dt class="s-num">2</dt>
            <dd class="s-text">
                2.填写核对订单信息
                <s></s>
                <b></b>
            </dd>
        </dl>

        <!-- 成功提交订单样式 -->
        <dl class="normal last">
            <dt class="s-num">3</dt>
            <dd class="s-text">
                3.成功提交订单
                <s></s>
                <b></b>
            </dd>
        </dl>

    </div>

</div>


<!-- 收货地址直到提交订单盒子 -->
<div id="container">
    <div id="content" class="w">
        <div class="orderInfo-tip hide" style="display: none;">
            <span class="wicon"></span>
            <span class="ftx-03">温馨提示：订单中存在不支持7天无理由退货商品，请确认相关商品信息后提交订单。</span>
            <span class="cls-btn" onclick="closeorderInfotip()">x</span>
        </div>

        <!-- 填写并核对订单信息 -->
        <div class="checkout-tit">
            <span class="tit-txt">填写并核对订单信息</span>
            <div class="extra-l hide" id="verifiedHintTip" style="display: none;">
                <div class="check-tips" id="verifiedHintContent">
                    由于@相关实名认证规定，收件人需在EZ WAY APP完成实名认证，以便订单包裹能顺利清关送达
                </div>
            </div>
        </div>

        <!-- 收货地址信息盒子 -->
        <div class="checkout-steps">
            <!-- 收货人信息盒子 -->
            <div class="step-tit">
                <h3>收货人信息</h3>
                <!--<div class="tips-new-white hide" id="tariffTip">
                    <b></b>
                    <span>目的国/地区如产生关税及其它相关费用，需用户自行承担</span>
                </div>-->

                <!-- 右边的新增收货地址 -->
                <%--<div class="extra-r" id="layerDemo" style="margin-bottom: 0">
                    <div class="layui-btn-container" style="margin-top: 0px;">
                        <button data-method="setTop" class="layui-btn ftx-05 J_consignee_global">新增收货地址</button>
                    </div>
                    <!--<a href="" class="ftx-05 J_consignee_global">新增收货地址</a>-->
                    <!--<input type="text" class="zidingyi_xinzengshouhuodizhi" type="hidden" id="del_consignee_type" value="0">-->
                </div>--%>

                <div style="margin-top: 15px">

                </div>


                <!--<div class="extra-r">
                    <a href="" class="ftx-05 J_consignee_global">新增收货地址</a>
                    <input type="text" class="zidingyi_xinzengshouhuodizhi" type="hidden" id="del_consignee_type" value="0">
                </div>-->

            </div>

            <!-- 具体的收货地址详细信息的盒子 -->
            <div class="step-cont">
                <div id="consignee-addr" class="consignee-content">
                    <div class="consignee-scrollbar">
                        <div class="ui-scrollbar-main">
                            <div class="consignee-scroll">
                                <div class="consignee-cont" id="consignee1" style="height: 42px;">
                                    <!--                                    <div class="consignee-cont" id="consignee1" style="height: 168px;">-->
                                    <ul class="shouhuodizhixinxi" id="consignee-list">

                                        <!-- 第一个地址信息 -->
                                        <li class="ui-switchable-panel ui-switchable-panel-selected addresslist firstAddress"
                                            style="display: list-item;" id="consignee_index_3644935329"
                                            selected="selected" c_li_custom_label="consignee_li">
                                            <div class="consignee-item item-selected">
                                                <input type="hidden" class="addressHiddenId"
                                                       value="${byCustomerIdAddressFirst.data.addressId}">
                                                <span class="custName"
                                                      limit="6">${byCustomerIdAddressFirst.data.addressName}</span>
                                                <b></b>
                                            </div>

                                            <!-- 地址详细信息 -->
                                            <div class="addr-detail">
                                                <span class="addr-name" limit="6"
                                                      title="哈哈哈">${byCustomerIdAddressFirst.data.addressName}</span>
                                                <span class="addr-info" limit="45"
                                                      title="哈哈 哈哈市 哈哈区 哈哈街道 哈哈哈哈区哈哈号楼">${byCustomerIdAddressFirst.data.addressProvince} ${byCustomerIdAddressFirst.data.addressCity} ${byCustomerIdAddressFirst.data.addressTown} ${byCustomerIdAddressFirst.data.addressStreet} ${byCustomerIdAddressFirst.data.detailedAddress}</span>
                                                <span class="addr-tel">${byCustomerIdAddressFirst.data.addressTelno}</span>
                                            </div>

                                            <!-- 详细地址右边的盒子 -->
                                            <div class="op-btns">
                                                <a href="" class="ftx-05 setdefault-consignee">设为默认地址</a>
                                                <a href="" class="ftx-05 edit-consignee">编辑</a>
                                                <a href="" class="ftx-05 del-consignee hide">删除</a>
                                            </div>

                                        </li>

                                        <!-- 第二个地址信息 -->
                                        <!-- 其他地址信息 -->
                                        <c:forEach items="${serverResponseAddressList.data}" var="add">
                                            <li class="ui-switchable-panel ui-switchable-panel-selected addresslist"
                                                style="display: list-item;" id="consignee_index_3561203024">

                                                <!-- 左边的姓名盒子 -->
                                                <div class="consignee-item" id="consignee_index_div_3561203024">
                                                    <input type="hidden" class="addressHiddenId"
                                                           value="${add.addressId}">
                                                    <span class="custName">${add.addressName}</span>
                                                    <b></b>
                                                </div>

                                                <!-- 右边的地址信息 -->
                                                <div class="addr-detail">
                                                    <span class="addr-name" limit="6"
                                                          title="嘿嘿嘿">${add.addressName}</span>
                                                    <span class="addr-info" limit="45"
                                                          title="江苏 苏州市 吴中区 苏州工业园区直属镇 若水路1号苏州工业园区职业技术学院">${add.addressProvince} ${add.addressCity} ${add.addressTown} ${add.addressStreet} ${add.detailedAddress}</span>
                                                    <span class="addr-tel">${add.addressTelno}</span>
                                                </div>

                                                <!-- 右边的隐藏盒子 -->
                                                <div class="op-btns">
                                                    <a href="" class="ftx-05 setdefault-consignee">设为默认地址</a>
                                                    <a href="" class="ftx-05 edit-consignee">编辑</a>
                                                    <a href="" class="ftx-05 del-consignee">删除</a>
                                                </div>

                                            </li>
                                        </c:forEach>


                                    </ul>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>

                <!-- 更多地址盒子 -->
                <div class="addr-switch switch-on hide" style="display: block" id="consigneeItemAllClick">
                    <span>更多地址</span>
                    <b></b>
                </div>

                <!-- 收起地址盒子 -->
                <div class="addr-switch switch-off" style="display: none" id="consigneeItemHideClick">
                    <span>收起地址</span>
                    <b></b>
                </div>

            </div>

            <!-- 空白位置 -->
            <div class="hr"></div>

            <!-- 支付信息 + 商品信息盒子 -->
            <div id="shipAndSkuInfo">
                <div id="payShipAndSkuInfo">

                    <!-- 支付方式字体盒子 -->
                    <div class="step-tit">
                        <h3>支付方式</h3>
                    </div>

                    <!-- 字符方式选择盒子 -->
                    <div class="step-cont">
                        <div class="payment-list">
                            <div class="list-cont">
                                <ul class="list-cont">
                                    <input type="hidden" id="instalmentPlan" value="false">
                                    <li style="cursor: pointer;">
                                        <div class="payment-item item-selected online-payment">
                                            <b></b>
                                            <em class="payment-promo">惠</em>
                                            在线支付

                                        </div>
                                    </li>
                                </ul>
                            </div>
                        </div>
                    </div>

                    <!-- 分割线 -->
                    <div class="hr"></div>

                    <!-- 送货清单 盒子 -->
                    <div class="step-tit">
                        <h3>送货清单</h3>
                        <div id="secondHint" class="tips-new-white hide"></div>
                    </div>

                    <!-- 商品信息盒子 -->
                    <div class="step-cont" id="skuPayAndShipment-cont">

                        <!-- 商品信息的二盒子 -->
                        <div class="shopping-lists" id="shopping-lists">

                            <!-- 定义大声品清单 list -->
                            <div class="hide" id="skuDetailInfo" notonemainsku="false">
                                <!--<div class="hide" id="skuDetailInfo" notonemainsku="false">-->

                                <!-- 配送方式 和 商品信息 盒子 -->
                                <div class="shopping-list ABTest wxw3 peisongandshangpin">

                                    <!-- 商品信息盒子 -->
                                    <div class="goods-list">

                                        <!-- 商品信息的商家 -->
                                        <div class="goods-tit">
                                            <h4 class="vendor_name_h vendor_name_0" id="0" fitvendername="false"
                                                vendername="树懒商城">商家：树懒商城</h4>
                                        </div>

                                        <!-- 商品信息 隐藏的 -->
                                        <div class="goods-items"></div>
                                        <div class="myordershangpinxinxi">

                                            <!-- 正式的商品信息 -->
                                            <div class="goods-items">
                                                <div class="goods-suit goods-last">
                                                    <!-- 商品上信息标题 -->
                                                    <div class="goods-suit-tit">
                                                        <span class="sales-icon">树懒</span>

                                                        <!-- 右边的信息 -->
                                                        <strong class="strong_zidingyiyangshi">树懒商城感谢您的信任</strong>

                                                    </div>
                                                    <div data-service></div>

                                                    <!-- 商品信息 -->
                                                    <div class="goods-item goods-item-extra">

                                                        <!-- 商品图片 -->
                                                        <div class="p-img">
                                                            <a href="" target="_blank">
                                                                <img src="${product.proImg}" alt>
                                                            </a>
                                                        </div>

                                                        <!-- 商品的描述 -->
                                                        <div class="goods-msg">
                                                            <div class="goods-msg-gel">

                                                                <!-- 商品的名称描述 -->
                                                                <div class="p-name">
                                                                    <a href="" target="_blank">
                                                                        ${product.proDesc}
                                                                    </a>
                                                                </div>

                                                                <!-- 商品 价格 数量 信息 -->
                                                                <div class="p-price ">

                                                                    <!-- 左边的价格样式 -->
                                                                    <strong class="jd-price">
                                                                        <span>￥</span>
                                                                        <span>${seckillPrice}</span>
                                                                        <del style="color: #999999">${product.proPrice}</del>
                                                                        <em class></em>
                                                                    </strong>

                                                                    <!-- 商品数量 -->
                                                                    <span class="p-num">1</span>

                                                                    <!-- 商品id -->
                                                                    <input type="hidden" class="productHiddenId"
                                                                           value="${product.proId}">

                                                                </div>

                                                            </div>
                                                        </div>


                                                        <!-- 商品属性 大盒子 -->
                                                        <div class="p-extra-continer">

                                                            <!-- 商品属性 小盒子 -->
                                                            <div class="p-extra-line">

                                                                <!-- 商品颜色 -->
                                                                <div class="fl">

                                                                    <strong>颜色：</strong>
                                                                    <span>${product.proColor}</span>

                                                                </div>

                                                                <!-- 商品型号 -->
                                                                <div class="fl">

                                                                    <strong>型号：</strong>
                                                                    <span>${product.proMemory}</span>

                                                                </div>

                                                            </div>

                                                        </div>

                                                        <!-- 隐藏的盒子 -->
                                                        <div class="clr"></div>
                                                        <div class="gift-item ftx-03"></div>


                                                    </div>

                                                </div>
                                            </div>

                                        </div>

                                    </div>

                                    <!-- 商品左边的配送方式盒子 -->
                                    <div class="dis-modes" id="dis_modes_0">

                                        <div class="mode-item mode-tab">

                                            <!-- 配送方式 盒子 -->
                                            <div class="mode-item-tit">

                                                <h4>配送方式</h4>

                                            </div>

                                            <!-- 快递盒子 -->
                                            <div class="mode-tab-nav">
                                                <ul class="psfs-group">
                                                    <input type="hidden" id="containFactoryShip" value="0">

                                                    <li class="mode-tab-item jd curr" id="jd_shipment_item">
                                                            <span id="jdShip-span-tip" class="m-txt">
                                                                树懒商城自选快递
                                                                <i class="qmark-icon qmark-tip"></i>
                                                            </span>
                                                        <b></b>
                                                    </li>

                                                </ul>
                                            </div>


                                            <!-- 收货地址盒子 -->
                                            <div class="mode-tab-con " id="jd_shipment">
                                                <ul class="mode-list">
                                                    <li id="shipment_times">
                                                        <div class="fore1 hide" id="Honor_tip_0"></div>

                                                        <!-- 快递到达时间 -->
                                                        <div class="fore1" id="jd_shipment_calendar_date"
                                                             data-text="    ">
                                                            <span class="mode-label ftx-03">标&nbsp;&nbsp;准&nbsp;&nbsp;达：</span>
                                                            <!-- 到达时间 -->
                                                            <!--<div class="mode-infor">
                                                                预计&nbsp;四天后到达
                                                                <span class="ftx-04">[下午]</span>
                                                                &nbsp;09:00-15:00&nbsp;送达
                                                            </div>-->
                                                            <div class="mode-infor">预计 四天后[四天] 15:00-19:00 送达</div>
                                                        </div>

                                                        <!-- 选择控件 -->
                                                        <div class="hide" id="jd_shipment_calendar_v2_zy">

                                                        </div>

                                                        <!-- 修改按钮样式 -->
                                                        <div class="fore2" id="jdshipdate_eidt_id">
                                                            <a href="" class="ftx-05 qidaishouhuodizhi">修改</a>
                                                        </div>

                                                    </li>

                                                    <!-- 快递 小的提示 -->
                                                    <li class="delivery-info-li" id="delivery-info-li-zxj">
                                                            <span class="delivery-tips fr">
                                                                <!-- 新 -->
                                                                <i class="d-ico fl mr5"></i>

                                                                <!-- 显示的盒子样式中的 上面的小箭头 -->
                                                                <i class="d-arr"></i>

                                                                <!-- 懒准达 -->
                                                                <a href="#none" id="zxj_show_id" class="mr5">懒准达</a>
                                                                <a href="#none" id="311_show_id" class="mr5">标准达</a>
                                                                <!--                                                                <a href="#none" id="411_show_id" class="mr5 hide">极速达</a>-->
                                                                配送服务全面升级

                                                            </span>
                                                    </li>

                                                </ul>
                                            </div>

                                        </div>

                                    </div>

                                    <!-- 间隔盒子 -->
                                    <div class="clr"></div>

                                    <!-- 总重量盒子 -->
                                    <div class="weight-cont total-freight-weight hide" style="display: block;">
                                        总重量：
                                        <em class="ftx-03 total-freight-weight-val">0.725kg</em>
                                    </div>

                                </div>


                            </div>

                        </div>


                    </div>

                </div>
            </div>

            <!-- 间隔线 -->
            <div class="hr"></div>

            <!-- 隐藏的盒子 -->
            <div class="clr"></div>

            <!-- 间隔线 -->
            <div class="hr"></div>


        </div>


        <!-- 订单包含商品数量、总商品金额、运费 -->
        <div class="order-summary orderInfo">
            <!-- 小盒子样式 -->
            <div class="statistic fr mt20">
                <div class="list">
                        <span>
                            <em class="ftx-01">1</em>
                             件商品，总商品金额：
                        </span>

                    <!-- 商品价格 -->
                    <em class="price" id="warePriceId">￥</em>
                    <em class="price" id="warePriceIdBiaoShi">${seckillPrice}</em>

                </div>

                <!-- 商品运费样式 -->
                <div class="list">
                    <span>运费：</span>
                    <em class="price mianfei" id="freightPriceId">
                        <del color="#000000">￥99</del>
                    </em>
                </div>

            </div>

            <!-- 隐藏盒子 -->
            <div class="clr"></div>

        </div>

        <div id="tooltip-box-common" class="hide"></div>

        <!-- 下面的商品的总价格、收货地址、收货人、提交订单盒子 -->
        <div class="trade-foot">

            <div id="plusInfoByFreight" class="hide"></div>
            <div id="plusInfo" class="hide"></div>

            <!--没有包含提交订单（按钮）盒子-->
            <div class="trade-foot-detail-com">
                <!-- 总金额盒子 -->

                <div class="actualTotalPrice">

                    <div class="fc-price-info">
                        <span class="price-tit">应付总额：</span>
                        <span class="price-num" id="sumPayPriceId">${seckillPrice}</span>
                        <span class="price-num" id="sumPayPriceIdBiaoshi">￥</span>
                    </div>

                </div>


                <!--包含收货地址、收货人信息-->
                <div class="selectAddressDetail">
                    <div class="fc-consignee-info">
                        <input type="hidden" class="addressId"/>
                        <span class="shouhuorenziti">寄送至： </span>
                        <span class="shouhuorenziti consigneeAddress">地址</span>
                        <span class="shouhuorenziti">收货人： </span>
                        <span class="shouhuorenziti consigneeName">王震</span>
                        <span class="shouhuorenziti consigneeTel">166****5563</span>
                    </div>
                </div>
            </div>

            <!-- 提交订单盒子 -->
            <div id="checkout-floatbar" class="group">
                <div class="ui-ceilinglamp checkout-buttons">
                    <div class="sticky-placeholder hide" style="display: none;"></div>
                    <div class="sticky-wrap">
                        <div class="inner">
                            <button class="checkout-submit" id="goToSeckillOrder">
                                <%--                                order-submit --%>
                                提交订单
                                <b></b>
                            </button>
                        </div>
                    </div>

                </div>
            </div>

            <!-- 返回顶部 盒子 -->
            <%--<div id="backpanel">
                <div id="backpanel-inner" class="hide switchOn" style="right: 224.5px;">
                    <div class="bp-item bp-item-survey">
                        <a href="" class="survey" target="_blank">树懒商城</a>
                    </div>

                    <!-- 返回顶部 -->
                    <div class="bp-item bp-item-backtop">
                        <a href="#none" class="backtop" target="_self">返回顶部</a>
                    </div>

                </div>
            </div>--%>


        </div>


    </div>


    <!--下方提示信息-->
    <div id="cmsfooter">
        <div id="service-2017">

            <!-- 多快好省 -->
            <div class="w hhzidingyi">
                <ol class="slogen">
                    <li class="item fore1">
                        <i>多</i>
                        品类齐全，轻松购物
                    </li>
                    <li class="item fore2">
                        <i>多</i>
                        多仓发货，极速配送
                    </li>
                    <li class="item fore3">
                        <i>好</i>
                        正品行货，精致服务
                    </li>
                    <li class="item fore4">
                        <i>省</i>
                        天天低价，畅选无忧
                    </li>
                </ol>
            </div>

            <!--下面的信息-->
            <div class="shulan-help">
                <div class="w hhzidingyi">
                    <div class="tishixinxi">
                        <span class="zititishixinxi">欢迎使用树懒商城，为您提供高质量的服务，是我们商城最高的追求！</span>
                    </div>
                </div>
            </div>

        </div>
    </div>


</div>

<script src="${pageContext.request.contextPath}/js/place_an_order.js"></script>

<script src="${pageContext.request.contextPath}/res/layui/layui.js" charset="utf-8"></script>

<script>

    function alertMessage(message, mesBtn, gourl) {
        //示范一个公告层
        layer.open({
            type: 1,
            title: false, //不显示标题栏
            closeBtn: false,
            area: '300px;',
            shade: 0.25,
            id: 'LAY_layuipro', //设定一个id，防止重复弹出
            btn: [mesBtn, '继续浏览'],
            btnAlign: 'c',
            moveType: 1, //拖拽模式，0或者1
            // content: '<div style="padding: 50px; line-height: 22px; background-color: #393D49; color: #fff; font-weight: 300;">你知道吗？亲！<br>layer ≠ layui<br><br> layer 只是作为 layui 的一个弹层模块，由于其用户基数较大，所以常常会有人以为 layui 是 <del>layerui</del><br><br>layer 虽然已被 Layui 收编为内置的弹层模块，但仍然会作为一个独立组件全力维护、升级 ^_^</div>'
            content: '<div style="padding: 50px; line-height: 22px; background-color: white; color: black; font-weight: 300;">' + message + '！</div>',
            success: function (layero) {
                var btn = layero.find('.layui-layer-btn');
                btn.find('.layui-layer-btn0').attr({
                    href: gourl
                    , target: '_blank'
                });
            }
        });
    };

</script>

<%-- layui 点击新增地址弹窗 --%>
<%--<script>
    // layui.use('layer', function(){ //独立版的layer无需执行这一句
    //     var $ = layui.jquery, layer = layui.layer; //独立版的layer无需执行这一句

        //触发事件
        var active = {
            setTop: function(){
                var that = this;
                //多窗口模式，层叠置顶
                layer.open({
                    type: 1 //此处以iframe举例
                    ,title: '新增收货人信息'
                    ,area: ['690px', '517px']
                    ,shade: 0
                    ,maxmin: true
                    ,offset: 'auto'
                    ,content: ''

                    ,btn: ['保存收货人信息'] //只是为了演示
                    /*,yes: function(){
                        $(that).click();
                    }*/

                });
            }

        };

        $('#layerDemo .layui-btn').on('click', function(){
            var othis = $(this), method = othis.data('method');
            active[method] ? active[method].call(this, othis) : '';
        });

    // });


</script>--%>


<%--  立即提交订单按钮  --%>
<script>
    $("#goToSeckillOrder").click(function () {
        // alert("按钮点击成功");
        $.ajax({
            type: "GET",
            url: "${pageContext.request.contextPath}/testsec",
            data: {
                secId: ${seckillProductId},
                addressId: $(".addressId").val()
            },
            dataType: 'json',
            success: function (result) {
                //实际操作的时候，返回的json对象中可能会有成功错误的判断标记，所以可能也需要判断一下
                // alert(JSON.stringify(result));
                console.log("返回的数据: " + JSON.stringify(result));

                if (result.code == 200) {
                    // alert("200"+JSON.stringify(result));

                    getResult(${seckill.data.secId});
                } else {
                    if (result.data == "请登录") {

                        var loginurl = "${pageContext.request.contextPath}/customer/login.jsp";
                        alertMessage("请先登录", "去登陆", loginurl);

                    } else {
                        layer.msg(result.data);

                    }

                }
            },
            error: function (result) {
                console.log("出错啦");
            }
        });
    });

    function getResult(secId) {
        // g_showLoading();
        $.ajax({
            type: "GET",
            url: "${pageContext.request.contextPath}/getSecRresult",
            data: {
                secId: ${seckillProductId}
            },
            // dataType: 'json',
            success: function (data) {
                //实际操作的时候，返回的json对象中可能会有成功错误的判断标记，所以可能也需要判断一下
                console.log("返回的数据: " + JSON.stringify(data));
                // alert(JSON.stringify(data));

                if (data.code == 200) {
                    // alert("200"+JSON.stringify(data));
                    <%--getResult(${seckill.data.secId});--%>

                    var result = data.data;
                    if (result < 0) {
                        layer.msg("对不起秒杀失败");

                    } else if (result == 0) {
                        layer.msg("订单生成中");
                        setTimeout(function () {
                            getResult(secId);
                            //    轮询时间间隔
                        }, 1000);
                    } else {
                        var seckillProductId = data.data;
                        console.log("成功");
                        alert(seckillProductId);

                        <%--window.location.href = "${pageContext.request.contextPath}/order/readyToPay/" + seckillProductId;--%>


                        alertMessage("恭喜您,秒杀成功!", "去支付", "${pageContext.request.contextPath}/order/readyToPay/"+seckillProductId);
                        <%--alertMessage("恭喜您,秒杀成功!", "去支付", "${pageContext.request.contextPath}/order/seckill_place_an_order?seckillProductId="+seckillProductId);--%>
                    }
                }
            },
            error: function (result) {
                layer.msg("客户端请求失败");
            },
        })
    }
</script>


<script type="text/javascript" src="${pageContext.request.contextPath}/res/jquery/jquery-3.5.1.js"></script>
<script>
    $(document).ready(function () {
        $(".user-info-yes").hide();
        <%--cartUrl="${pageContext.request.contextPath}/myorder/${loginCustomer.custId}";--%>
        <%--orderUrl="${pageContext.request.contextPath}/shopcar/${loginCustomer.custId}";--%>
        $.get("${pageContext.request.contextPath}/cookie/login", null,
            function (result) {
                console.log(JSON.stringify(result));
                if (result.code == 200) {
                    cartUrl = "${pageContext.request.contextPath}/shopcar";
                    orderUrl = "${pageContext.request.contextPath}/myorder";

                    $(".user-info-no").hide();
                    $(".user-info-yes").show();
                    $(".userNickName").text(result.data.custNickname);
                    $(".order-href").attr("href", orderUrl);

                    $(".cart-href").attr("href", cartUrl);
                    $(".cart-href").attr("target", "_blank");
                } else {
                }


            }, 'json');
    });

    function logout() {
        $.get("${pageContext.request.contextPath}/cust/logout", null,
            function (data) {
                location.reload();
            }, 'json');
    }
</script>

<script>


    /* 更改选择的地址 */
    $(document).ready(function () {
        $(".addresslist").click(function () {
            $(".addresslist").children("div.consignee-item").removeClass("item-selected");
            $(this).children("div.consignee-item").addClass("item-selected");
            selectAddressId = $(".item-selected").children("input.addressHiddenId").val();
        });
    });


    $(document).ready(function () {
        $(".addressId").val($(".firstAddress").children("div.consignee-item").children("input.addressHiddenId").val());
        $(".consigneeAddress").text($(".firstAddress").children("div.addr-detail").children("span.addr-info").text());
        $(".consigneeName").text($(".firstAddress").children("div.addr-detail").children("span.addr-name").text());
        $(".consigneeTel").text($(".firstAddress").children("div.addr-detail").children("span.addr-tel").text());
    });

    $(".addresslist").click(function () {
        $(".addressId").val($(this).children("div.consignee-item").children("input.addressHiddenId").val());
        $(".consigneeAddress").text($(this).children("div.addr-detail").children("span.addr-info").text());
        $(".consigneeName").text($(this).children("div.addr-detail").children("span.addr-name").text());
        $(".consigneeTel").text($(this).children("div.addr-detail").children("span.addr-tel").text());

    });
</script>


</body>
</html>